Skip to content

Upgraded graphene to strawberry for python 3.13 compatibility#3

Open
ryanschostag wants to merge 9 commits into
ronidas39:mainfrom
ryanschostag:ryan-schostag-updates-1
Open

Upgraded graphene to strawberry for python 3.13 compatibility#3
ryanschostag wants to merge 9 commits into
ronidas39:mainfrom
ryanschostag:ryan-schostag-updates-1

Conversation

@ryanschostag

Copy link
Copy Markdown
  • Replaced graphene with strawberry
  • Tested all of the tutorial modules
  • Fixed import issues in supporting modules to the main module where app lives for uvicorn
  • Run something like this command in the root directory: uvicorn --host localhost --port 23647 --reload tutorial9.main:app
  • Did not update PowerPoint files

… remove Graphene

feat: replace deprecated `starlette.graphql.GraphQLApp` with
`strawberry.fastapi.GraphQLRouter` and provide Strawberry schemas/mounts in:
- `tutorial2/usecase1.py`, `tutorial2/usecase2.py`
- `tutorial3/main.py`
- `tutorial4/main.py`
- `tutorial5/main.py`
- `tutorial6/main.py`
- `tutorial7/main.py`
- `tutorial8/main.py`
- `tutorial9/main.py`

feat: convert Graphene schema modules to Strawberry types:
- `tutorial3/schema.py` -> `Course`
- `tutorial4/schema.py` -> `Employee`
- `tutorial5/schema.py` -> `Weather`
- `tutorial8/schema.py` -> `Player` interface, `FootballPlayer`, `CricketPlayer`
- `tutorial9/schema.py` -> `FootballPlayer`, `CricketPlayer`, `Invalid`

feat: convert Graphene mapping modules to Strawberry `Query` implementations:
- `tutorial3/mapping.py`, `tutorial4/mapping.py`, `tutorial5/mapping.py`,
  `tutorial8/mapping.py`, `tutorial9/mapping.py`

fix: correct data and resolver bugs, remove minor issues and cleanup
- `tutorial2/usecase1.py`: fix typo `computer sience` → `computer science`; correct
  resolver parameter `into` → `info`.
- `tutorial2/usecase2.py`: remove redundant imports and avoid shadowing built-in
  `int`; convert to Strawberry types.
- `tutorial4/data.py`: use context manager (`with open`) and remove explicit `close()`.
- `tutorial5/data.py`, `tutorial9/data.py`: remove duplicated `data=data = [...]`.
- formatting/whitespace/trailing-newline cleanups across tutorials.

fix: remove all `import graphene` usages across the tutorial modules.

Notes:
- External packages `fastapi` and `strawberry` are required at runtime; static diagnostics
  may appear until dependencies are installed.
- Functionality preserved: resolvers now return typed Strawberry objects and routes are
  mounted at `/graphql` consistently.
…r the data.csv file in tutorial4/data.csv where data.py could not find data.csv
…not through import errors duing app startup in uvicorn when running uvicorn from the root directory
…: Feat: replaced graphene with strawberry in tutorial modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants